package com.osi.project.redis.manager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.osi.start.common.business.dao.CommonDao;
import com.osi.start.common.business.dto.BasePageRespDTO;
import com.osi.start.common.business.dto.RespUtil;
import com.osi.start.framework.business.service.BaseManagerImpl;
import com.osi.project.redis.generate.dao.RedisSlowLogCommonDao;
import com.osi.project.redis.dao.RedisSlowLogDao;
import com.osi.project.redis.generate.pojo.RedisSlowLogDO;
import com.osi.project.redis.req.RedisSlowLogReqVO;
import com.osi.project.redis.resp.RedisSlowLogRespVO;

/**
 * @Desc   本地服务类接口的实现类
 * @author pwh
 * @date 2018年01月01日 09:09:09
 * @Copyright (c) onestop
 */
@Repository
public class RedisSlowLogManager extends BaseManagerImpl<RedisSlowLogDO> {

	@Autowired
	private RedisSlowLogCommonDao redisSlowLogCommonDao;

	@Autowired
	private RedisSlowLogDao redisSlowLogDao;

	public RedisSlowLogCommonDao getCommonDao() {
		return redisSlowLogCommonDao;
	}

	public RedisSlowLogDao getDao() {
		return redisSlowLogDao;
	}

	/**
	 * 功能：按条件完全匹配查找
	 * @param redisSlowLogReqVO
	 * @param startPage
	 * @param pageSize
	 * @return
	 */
	public BasePageRespDTO<RedisSlowLogRespVO> queryPageEqualCondition(RedisSlowLogReqVO redisSlowLogReqVO,
			Integer startPage, Integer pageSize) {
		PageHelper.startPage(startPage, pageSize, true);
		Page<RedisSlowLogRespVO> pageData = redisSlowLogCommonDao.listEqualCondition(redisSlowLogReqVO);
		return RespUtil.tranPageData(pageData);
	}
	
	/**
	 * 功能：按条件完全匹配查找
	 * @param redisSlowLogReqVO
	 * @param startPage
	 * @param pageSize
	 * @param orderBy
	 * @return
	 */
	public BasePageRespDTO<RedisSlowLogRespVO> queryPageEqualCondition(RedisSlowLogReqVO redisSlowLogReqVO,
			Integer startPage, Integer pageSize, String orderBy) {
		PageHelper.startPage(startPage, pageSize, true);
		Page<RedisSlowLogRespVO> pageData = redisSlowLogCommonDao.listEqualConditionOrderBy(redisSlowLogReqVO, orderBy);
		return RespUtil.tranPageData(pageData);
	}

	/**
	 * 功能：按字符串模糊匹配和数字完全匹配查找
	 * @param redisSlowLogReqVO
	 * @param startPage
	 * @param pageSize
	 * @return
	 */
	public BasePageRespDTO<RedisSlowLogRespVO> queryPageLikeCondition(RedisSlowLogReqVO redisSlowLogReqVO,
			Integer startPage, Integer pageSize) {
		PageHelper.startPage(startPage, pageSize, true);
		Page<RedisSlowLogRespVO> pageData = redisSlowLogCommonDao.listLikeCondition(redisSlowLogReqVO);
		return RespUtil.tranPageData(pageData);
	}

	/**
	 * 功能：按字符串模糊匹配和数字完全匹配查找
	 * @param redisSlowLogReqVO
	 * @param startPage
	 * @param pageSize
	 * @param orderBy
	 * @return
	 */
	public BasePageRespDTO<RedisSlowLogRespVO> queryPageLikeCondition(RedisSlowLogReqVO redisSlowLogReqVO,
			Integer startPage, Integer pageSize, String orderBy) {
		PageHelper.startPage(startPage, pageSize, true);
		Page<RedisSlowLogRespVO> pageData = redisSlowLogCommonDao.listLikeConditionOrderBy(redisSlowLogReqVO, orderBy);
		return RespUtil.tranPageData(pageData);
	}
}
